package com.zi.experttalk.experttalk.View;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.zi.experttalk.experttalk.Model.service.AlterDialogManager;
import com.zi.experttalk.experttalk.Model.service.LocationManager;
import com.zi.experttalk.experttalk.R;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by lenovo on 2014/12/10.
 */
public class NearActivity extends Activity {

    private Button near_location_Button;
    private Button near_map_Button;
    private Button near_list_Button;
    private ListView near_list_ListView;
    private TextView near_location_TextView;
    private Button near_range_Button;
    private Button near_class_Button;
    //范围
    List<String> range = new ArrayList<String>();

    //全部分类
    List<String> allclass = new ArrayList<String>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.near);

        final AlterDialogManager alterDialogManager = new AlterDialogManager();

        near_location_Button = (Button) findViewById(R.id.near_location_Button);
        near_range_Button = (Button) findViewById(R.id.near_range_Button);
        near_class_Button = (Button) findViewById(R.id.near_class_Button);
        near_list_ListView = (ListView) findViewById(R.id.near_list_ListView);
        near_location_TextView = (TextView) findViewById(R.id.near_location_TextView);
        //范围的数据
        range.add("1000米");
        range.add("2000米");
        range.add("3000米");
        range.add("4000米");
        range.add("5000米");
        //全部分类的测试数据
        allclass.add("全部分类");
        allclass.add("运动");
        allclass.add("美食");
        allclass.add("店庆促销");
        //初始化定位
        LocationManager locationManager = new LocationManager();
        locationManager.getAdd(NearActivity.this);

        /**
         *near_location_Button点击事件
         */
        near_location_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LocationManager locationManager = new LocationManager();
                locationManager.getAdd(NearActivity.this);
                Log.d("onClick", "点击location");
            }
        });
        near_map_Button = (Button) findViewById(R.id.near_map_Button);
        /**
         *near_map_Button点击事件
         */
        near_map_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                near_list_Button.setVisibility(View.VISIBLE);
                near_map_Button.setVisibility(View.GONE);
                near_list_ListView.setVisibility(View.GONE);
                Log.d("onClick", "点击map");
            }
        });
        near_list_Button = (Button) findViewById(R.id.near_list_Button);
        /**
         *near_list_Button点击事件
         */
        near_list_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                near_list_Button.setVisibility(View.GONE);
                near_map_Button.setVisibility(View.VISIBLE);
                near_list_ListView.setVisibility(View.VISIBLE);
                Log.d("onClick", "点击list");
            }
        });
        /**
         * near_range_Button点击事件
         */
        near_range_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                alterDialogManager.setAlterDialog(NearActivity.this, range, near_range_Button,new AlterDialogManager.GetSelecterListener() {
                    @Override
                    public void onResultListener(String selecterItem) {

                    }
                });

            }
        });
        /**
         *near_class_Button点击事件
         */
        near_class_Button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                alterDialogManager.setAlterDialog(NearActivity.this, allclass, near_class_Button,new AlterDialogManager.GetSelecterListener() {
                    @Override
                    public void onResultListener(String selecterItem) {

                    }
                });
                Log.d("onClick", "点击class");
            }
        });
    }
}
